package com.lsj.config.security;

import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;

//@Component
//@Primary //作为默认的UserDetailService
public class UserDetailServiceImpl implements UserDetailsService {
    //为了方便，直接返回一个User对象，没有接入数据库
    @Override
    public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException {
        return new User(s,
                "123456",
                true,
                true,
                true,
                true,
                AuthorityUtils.createAuthorityList("ROLE_user"));
    }
}
